<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-resourcesType-edit" th:object="${resourcesType}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">资源名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">资源类型：</label>
				<div class="col-sm-8">
					<input id="type" name="type" th:field="*{type}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">类型排序：</label>
				<div class="col-sm-8">
					<input id="typeSort" name="typeSort" th:field="*{typeSort}" class="form-control" type="number">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">资源描述：</label>
				<div class="col-sm-8">
					<textarea id="remarks" name="remarks" class="form-control">[[*{remarks}]]</textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">创建人：</label>
				<div class="col-sm-8">
					<input id="createBy" name="createBy" th:field="*{createBy}" class="form-control" type="text" disabled="disabled">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">创建时间：</label>
				<div class="col-sm-8">
					<input id="createTime" name="createTime" th:value="${#dates.format(resourcesType.createTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text" disabled="disabled">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">更新人：</label>
				<div class="col-sm-8">
					<input id="updateBy" name="updateBy" th:field="*{updateBy}" class="form-control" type="text" disabled="disabled">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">更新时间：</label>
				<div class="col-sm-8">
					<input id="updateTime" name="updateTime"  th:value="${#dates.format(resourcesType.updateTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text" disabled="disabled">
				</div>
			</div>


		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/resourcesType"
		$("#form-resourcesType-edit").validate({
			rules:{
				typeSort: {
					required: true,
				},
				name:{
					required:true,
				},
				type:{
					required:true,
					minlength: 3,
					remote: {
						url: prefix + "/checkTypeUnique",
						type: "post",
						dataType: "json",
						data: {
							id : function() {
								return $("#id").val();
							},
							type : function() {
								return $.common.trim($("#type").val());
							}
						},
						dataFilter: function(data, type) {
							return $.validate.unique(data);
						}
					}
				},
			},
			messages: {
				"type": {
					remote: "该资源类型已经存在"
				}
			}

		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-resourcesType-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
